﻿using System;
using System.Windows.Forms;
using DevExpress.XtraBars.Helpers;
using DevExpress.XtraBars.Ribbon;
using Shared;
using CrystalDecisions.CrystalReports.Engine;
namespace System2012
{
    public partial class MdiForm : RibbonForm
    {
        MdiClient mdiClient = null;
        ReportDocument rptDoc = new ReportDocument();
        public MdiForm()
        {
            
            this.InitializeComponent();
            this.InitSkinGallery();
            Shared.CheckExistsForms.MdiParent = this;
            this.Size = new System.Drawing.Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
            this.Location = new System.Drawing.Point(Screen.PrimaryScreen.WorkingArea.X, Screen.PrimaryScreen.WorkingArea.Y);
            foreach (Control c in this.Controls)
            {
                if (c is MdiClient)
                {
                    mdiClient = (MdiClient)c;
                    continue;
                }
            }

        }

        void InitSkinGallery()
        {
            SkinHelper.InitSkinGallery(this.rgbiSkins, true);
        }

        private void Tiempo_Tick(object sender, EventArgs e)
        {
            this.lblFecha.Caption = String.Concat("Fecha: ", DateTime.Now.ToShortDateString(), " Hora: ", DateTime.Now.ToShortTimeString());
        }

        private void RibbonControlMerge(object sender, RibbonMergeEventArgs e)
        {
            DevExpress.XtraBars.Ribbon.RibbonControl parent = (DevExpress.XtraBars.Ribbon.RibbonControl)sender;
            DevExpress.XtraBars.Ribbon.RibbonControl hijo = e.MergedChild;
            parent.StatusBar.MergeStatusBar(hijo.StatusBar);
        }

       

        private void RibbonControlItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if ((string)e.Item.Tag == "Documentos")
            {
                CheckExistsForms.ActivateForm<System2012.Sistema.Documentos.MantenimientoDocumentos>().Show();
            }
            if ((string)e.Item.Tag == "verSeries")
            {
                CheckExistsForms.ActivateForm<System2012.Sistema.Documentos.FrmConfiSeriesComprobantes>().Show();
            }
            if ((string)e.Item.Tag == "VerClientes") {
                CheckExistsForms.ActivateForm<Persona.Clientes.Cliente>().Show();           
            }
            if ((string)e.Link.Item.Tag == "VerEmpleados")
            {
                CheckExistsForms.ActivateForm<Persona.Empleados.MantenimientoEmpleados>().Show();
            }
            if ((string)e.Link.Item.Tag == "VerProveedores")
            {
                CheckExistsForms.ActivateForm<Persona.Proveedores.MantenimientoProveedores>().Show();
            }
            if ((string)e.Link.Item.Tag == "verHabitaciones")
            {
                CheckExistsForms.ActivateForm<Hotel.FrmHabitacion>().Show();
            }

            if ((string)e.Link.Item.Tag == "verCajaBancos")
            {
                CheckExistsForms.ActivateForm<Caja.frmCaja>().Show();
            }

            if ((string)e.Link.Item.Tag == "verProductos")
            {
                CheckExistsForms.ActivateForm<Almacen.frmProducto>().Show();
            }
            if ((string)e.Link.Item.Tag == "verGrupos")
            {
                CheckExistsForms.ActivateForm<Almacen.frmGrupos>().Show();
            }
            if ((string)e.Link.Item.Tag == "verFamillas")
            {
                CheckExistsForms.ActivateForm<Almacen.frmSubGrupo>().Show();
            }
            if ((string)e.Link.Item.Tag == "verUnidades")
            {
                CheckExistsForms.ActivateForm<Almacen.frmUnidades>().Show();
            }
            if ((string)e.Link.Item.Tag == "verAlmacen")
            {
                CheckExistsForms.ActivateForm<Almacen.frmAlmacen>().Show();
            }
            if ((string)e.Link.Item.Tag == "verFacturacion")
            {
                CheckExistsForms.ActivateForm<Ventas.frmFacturacion>().Show();
            }
            if ((string)e.Link.Item.Tag == "verPedidos")
            {
                CheckExistsForms.ActivateForm<Ventas.frmPedidos>().Show();
            }
            if ((string)e.Link.Item.Tag == "verCotizacion")
            {
                CheckExistsForms.ActivateForm<Ventas.frmCotizacion>().Show();
            }
            if ((string)e.Link.Item.Tag == "verGuiasRemisionn")
            {
                CheckExistsForms.ActivateForm<Ventas.frmGuiaRemision>().Show();
            }
            if ((string)e.Link.Item.Tag == "verNotaCredito")
            {
                CheckExistsForms.ActivateForm<Ventas.frmNotaCredito>().Show();
            }
            if ((string)e.Link.Item.Tag == "verSolCredito")
            {
                CheckExistsForms.ActivateForm<Ventas.frmSolicitudCredito>().Show();
            }
            if ((string)e.Link.Item.Tag == "verTransferencias")
            {
                CheckExistsForms.ActivateForm<Almacen.frmTraslados>().Show();
            }
            if ((string)e.Link.Item.Tag == "verOtrosIng")
            {
                CheckExistsForms.ActivateForm<Almacen.frmOtrosIngresos>().Show();
            }
            if ((string)e.Link.Item.Tag == "verOtrasSalidas")
            {
                CheckExistsForms.ActivateForm<Almacen.frmOtrasSalidas>().Show();
            }
            if ((string)e.Link.Item.Tag == "verTomaInventario")
            {
                CheckExistsForms.ActivateForm<Almacen.frmTomaInventario>().Show();
            }
            if ((string)e.Link.Item.Tag == "verCompras")
            {
                CheckExistsForms.ActivateForm<Compras.RegistroComprasDetalle >().Show();
            }
            if ((string)e.Link.Item.Tag == "verCtasporCobrar")
            {
                CheckExistsForms.ActivateForm<Creditos.frmCtasporCobrar>().Show();
            }
            if ((string)e.Link.Item.Tag == "VerListProuctos")
            {
                CheckExistsForms.ActivateForm<Almacen.Consultas.frmListadoProductos>().Show();
            }
            if ((string)e.Link.Item.Tag == "verConfiguracion")
            {
                CheckExistsForms.ActivateForm<Sistema.Configuracion.frmConfiguracion>().Show();
            }
        }

        private void MdiForm_Load(object sender, EventArgs e)
        {

        }
    }
}